{extend name="index/index"/}

{block name="body"}
<script language="javascript">
    $(document).ready(function () {
        UM.getEditor('editor');
    });
    $(document).ready(common_obj.form_submit);
</script>

<header class="tab-head">
    <ul class="nav nav-tabs">
        <li class="">
            <a href="{:url('News/news')}">新闻列表</a>
        </li>

        <li class="active">
            <a href="{:url('News/newsadd')}">添加新闻</a>
        </li>
    </ul>
</header>

<section class="wrapper" style="margin-top:0">
    <div class="row">
        <div class="col-lg-12">
            <section class="panel">
                <div class="panel-body">
                    <div class="form">
                        <form class="cmxform form-horizontal tasi-form" id="data-form">

                            <div class="form-group">
                                <label class="control-label col-lg-2">标题</label>
                                <div class="col-lg-10">
                                    <input class="form-control" type="text" name="title" required="required" value="{$data.title}"/>
                                </div>
                            </div>

                            <div class="form-group reply-news">
                                <label class="control-label col-lg-2">分类</label>
                                <div class="col-lg-10">
                                    <select class="form-control m-bot15" name="category_id" required="required">
                                        {volist name="categoryList" id="vo"}
                                        <option value="{$vo.id}" {eq name="data.category_id" value="$vo.id" }selected="selected" {/eq}>{$vo.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>

                            <div class="form-group reply-image more-img" data-imgname="imgpath[]">
                                <label class="control-label col-lg-2">图片</label>
                                <div class="col-lg-10">
                                    <div id="picker" class="webuploader-picker">选择文件</div>
                                    <p class="help-block">共可上传<span>3</span>张图片，图片大小建议：640*400像素</p>
                                </div>

                                <div class="col-lg-10 col-lg-offset-2 img">
                                    {volist name="data.imgpath" id="v"}
                                    <div>
                                        <a href="{$v}" target="_blank">
                                            <img src="{$v}">
                                        </a>
                                        <span>删除</span>
                                        <input type="hidden" name="imgpath[]" value="{$v}">
                                    </div>
                                    {/volist}
                                </div>
                            </div>

                            <div class="form-group reply-news">
                                <label class="control-label col-lg-2">详情</label>
                                <div class="col-lg-10">
                                    <script type="text/plain" id="editor" name="content" style="width:1000px;height:240px;">{$data.content}</script>
                                </div>
                            </div>

                            <input type="hidden" name="id" value="{$data.id}">

                            <div class="form-group">
                                <div class="col-lg-offset-2 col-lg-10">
                                    <input class="btn btn-danger" type="submit" value="提交保存">
                                    <!--<a href="{:url('News/news',array('bk'=>1))}">
                                        <button class="btn btn-default" type="button">返回</button>
                                    </a>-->
                                </div>
                            </div>
                        </form>
                        <input type="hidden" id="do_action" value="{:url('News/newsadd')}">
                    </div>
                </div>
            </section>
        </div>
    </div>
</section>
{/block}